package com.refusea.train.controller

import com.refusea.train.domain.entity.Classroom
import com.refusea.train.domain.helper.ClassroomHelper
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * @author Zhang Yan 2024/4/1
 **/
@RestController
@RequestMapping("/api/private/classroom")
class ClassroomController(private val classroomHelper: ClassroomHelper) {

    @GetMapping("/list")
    fun list(): List<Classroom> {
        return classroomHelper.list()
    }

    @PostMapping("/save")
    fun save(@RequestBody req: Classroom): Int {
        return classroomHelper.save(req)
    }

    @GetMapping("/delete")
    fun delete(id: Int) {
        return classroomHelper.delete(id)
    }

}
